﻿@using System.Data.Entity
@using Share.Models

@model Category
@{
    <script>
        $(document).ready(function () {
            $('#products').dataTable({
                "bProcessing": true,
                "sAjaxSource": '/api/product?catId=@Model.ID',
                "sAjaxDataProp": '',
                "aoColumnDefs": [
                     { "aTargets": [0], "mData": "No", "sTitle": "No.", "sWidth": "50px" },
                     { "aTargets": [1], "mData": "Photo", "sTitle": "Photo", "sWidth": "80px",
                         "fnRender": function (o, val) {
                             return "<div class='prdThumb60'><img src='" + val + "' /></div>";
                         }
                     },
                     { "aTargets": [2], "mData": "Name", "sTitle": "Name" },
                     { "aTargets": [3], "mData": "Price.Basic", "sTitle": "Basic Price" },
                     { "aTargets": [4], "mData": "Price.WholeSale", "sTitle": "Wholesale Price" },
                     { "aTargets": [5], "mData": "Status", "sTitle": "Status", "sWidth": "100px" },
                     { "aTargets": [6], "mData": null, "sTitle": "Action", "sWidth": "100px",
                         "fnRender": function (o, val) {
                             return "<a href='#'>Delete</a>";
                         }
                     }
                ]
            });

            var uploader = new qq.FileUploader({
                // pass the dom node (ex. $(selector)[0] for jQuery users)
                element: document.getElementById('file-uploader'),
                // path to server-side upload script
                action: '/server/upload'
            });
        });
    </script>

    <div class="grid_14">
        <a href="/">Home</a> &gt; <a href="/Category">Category</a> &gt; Edit
        <hr />
    </div>
    <div class="grid_14">
        <div class="box">
            <h2>Product Category Edit</h2>
            <div class="tabber">
                <div class="tabbertab" title="Information">
                    @using (Html.BeginForm()){
                    <table class="width300">
                        <tr>
                            <th width="100">Parent category:</th><td>@if(Model.ParentCategory!=null){ @Model.ParentCategory.Name; } <!--select><option>Select category...</option></select--></td>
                        </tr>
                        <tr>
                            <th>Name:</th><td>@Html.TextBoxFor(m=>m.Name)</td>
                        </tr>
                        <tr>
                            <th>Description:</th><td>@Html.TextAreaFor(m=>m.Description)</td>
                        </tr>
                        <tr>
                            <th>Photo:</th>
                            <td>
                                @Html.HiddenFor(m=>m.Photo)
                                <div id="file-uploader">
                                <noscript>
                                    <p>Please enable JavaScript to use file uploader.</p>
                                    <!-- or put a simple form for upload here -->
                                </noscript>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <th>Enabled:</th><td>@Html.RadioButtonFor(m=>m.Status, "Enable")Enable @Html.RadioButtonFor(m=>m.Status, "Disable")Disable</td>
                        </tr>
                        <tr>
                            <th></th><td><input type="submit" value="Submit" /></td>
                        </tr>
                    </table>
                    }
                </div>
                <!--div class="tabbertab" title="Products">
                    <p class="right"><b><a href="#">Add Product</a></b></p>
                    <table id="products" width="100%"></table>
                    <div class="clear"></div>
                </div-->
            </div>
            <div class="clear"></div>
        </div>
    </div>
}
